<!DOCTYPE html>
<html lang="en">
<head>
    <title>用户管理</title>
</head>
<body class="fixed-left">
<div id="wrapper">
    <#include "../header.html">
        <div class="content-page">
            <div class="content">
                <div class="container">
                    <div class="row">


                        <form class="narbar-form navbar-left" role="search" method="get" style="width: 500px;">
                            <div class="form-group col-xs-6" style="margin-top: 10px;">
                                <input type="text" value="<#if queryParam.username??>${queryParam.username}</#if>"
                                       name="username" placeholder="用户名" class="form-control"/>
                            </div>
                            <button type="submit" class="btn btn-default col-xs-3" style="margin-top: 10px">搜索</button>
                            <a href="/admin/user/add" class="btn btn-default col-xs-2" style="margin-top: 10px;margin-left: 10px">添加用户</a>
                        </form>
                        <div class="col-md-12">
                            <table class="table table-striped table-bordered">
                                <thead>
                                <tr>
                                    <th width="15%">编号</th>
                                    <th width="15%">用户名</th>
                                    <th width="15%">密码</th>
                                    <th width="15%">登录次数</th>
                                    <th width="15%">最后登录时间</th>
                                    <th width="15%">状态</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <#list pageInfo.list as post>
                                    <tr>
                                        <td>
                                            ${post.id}
                                        </td>
                                        <td>${post.username}</td>
                                        <td>${post.password}</td>
                                        <td>${post.loginnum}</td>
                                        <td>${post.lastlogintime?datetime}</td>
                                        <td>
                                            <#if post.status == 0>正常
                                                <#else>禁用
                                            </#if>
                                        </td>
                                        <td>
                                            <a href="/admin/user/edit/${post.id}"
                                           class=" btn btn-primary btn-sm waves-effect waves-light m-b-5"><i
                                                class="fa fa-edit"></i> <span>编辑</span></a>
                                            <a href="javascript:void(0)" onclick="delPost(${post.id});"
                                               class="btn btn-danger btn-sm waves-effect waves-light m-b-5"><i
                                                    class="fa fa-trash-o"></i> <span>删除</span></a>
                                        </td>
                                    </tr>
                                </#list>
                                </tbody>
                            </table>
                            <div class="clearfix">
                                <ul class="pagination  m-b-5 pull-right">
                                    <#if pageInfo.hasPreviousPage>
                                        <li>
                                            <a href="?page=${pageInfo.prePage}" aria-label="Previous">
                                                <i class="fa fa-angle-left"></i>&nbsp;上一页
                                            </a>
                                        </li>
                                    </#if>
                                    <#list pageInfo.navigatepageNums as nav>
                                        <#if nav == pageInfo.pageNum>
                                            <li class="active"><a href="#">${nav}</a></li>
                                        </#if>
                                        <#if nav != pageInfo.pageNum>
                                            <li class="">
                                                <a href="?page=${nav}&rows=${pageInfo.pageSize}&username=<#if queryParam.username??>${queryParam.username}</#if>">${nav}</a>
                                            </li>
                                        </#if>
                                    </#list>

                                    <#if pageInfo.hasNextPage>
                                        <li>
                                            <a thref="?page=${pageInfo.nextPage}" aria-label="Next">
                                                下一页&nbsp;<i class="fa fa-angle-right"></i>
                                            </a>
                                        </li>
                                    </#if>

                                    <li><span>共${pageInfo.pages}页</span></li>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
</div>
<#include "../footer.html">
    <script type="text/javascript">
        /*<![CDATA[*/
        var tale = new $.tale();

        function delPost(cid) {
            tale.alertConfirm({
                title: '确定删除该文章吗?',
                then: function () {
                    tale.post({
                        url: '/admin/user/delete',
                        data: {id: cid},
                        success: function (result) {
                            if (result && result.status==200) {
                                tale.alertOkAndReload('城市删除成功');
                            } else {
                                tale.alertError('城市删除失败');
                            }
                        }
                    });
                }
            });
        }

        /*]]>*/
    </script>
</body>
</html>